package org.ISCS.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;

/**
 * 
 * @TableName service
 */
@TableName(value ="service")
@Data
public class Services implements Serializable {
    /**
     * 服务id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 服务名称
     */
    private String serviceName;

    /**
     * 服务版本号
     */
    private String serviceVersion;

    /**
     * 所属项目id
     */
    private Long affiliateProjectId;

    /**
     * 实例数
     */
    private Integer instanceNum;

    /**
     * 访问次数
     */
    private Integer visitTimes;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Services other = (Services) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getServiceName() == null ? other.getServiceName() == null : this.getServiceName().equals(other.getServiceName()))
            && (this.getServiceVersion() == null ? other.getServiceVersion() == null : this.getServiceVersion().equals(other.getServiceVersion()))
            && (this.getAffiliateProjectId() == null ? other.getAffiliateProjectId() == null : this.getAffiliateProjectId().equals(other.getAffiliateProjectId()))
            && (this.getInstanceNum() == null ? other.getInstanceNum() == null : this.getInstanceNum().equals(other.getInstanceNum()))
            && (this.getVisitTimes() == null ? other.getVisitTimes() == null : this.getVisitTimes().equals(other.getVisitTimes()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getServiceName() == null) ? 0 : getServiceName().hashCode());
        result = prime * result + ((getServiceVersion() == null) ? 0 : getServiceVersion().hashCode());
        result = prime * result + ((getAffiliateProjectId() == null) ? 0 : getAffiliateProjectId().hashCode());
        result = prime * result + ((getInstanceNum() == null) ? 0 : getInstanceNum().hashCode());
        result = prime * result + ((getVisitTimes() == null) ? 0 : getVisitTimes().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", serviceName=").append(serviceName);
        sb.append(", serviceVersion=").append(serviceVersion);
        sb.append(", affiliateProjectId=").append(affiliateProjectId);
        sb.append(", instanceNum=").append(instanceNum);
        sb.append(", visitTimes=").append(visitTimes);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}